let value = "yahoo.com";
value = "sina.com";

// 明确设置变量类型
let v: number = 100;
// v = true;

let state: boolean = true;
state = 1 > 2;

// 报错，number相加的返回值应该是number
// function sum(a: number, b: number):string {
//     return a + b;
//   }
console.log("123");

// 参数是number，typescript推断sum返回值是number类型
function sum(a: number, b: number) {
  return a + b;
}

// 强制修改返回值类型，不要typescript推断
function sum2(a: number, b: number): string {
  return "结果是: " + (a + b);
}

console.log(sum(1, 2));
console.log(sum2(1, 2));
